package com.view;

import android.app.ActionBar;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.firewarning.R;
import com.service.UserService;

public class SettingActivity extends BaseActivity{
    private Button button;
    private ImageView imageBack;
    private EventHandler handler;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        android.support.v7.app.ActionBar actionBar = getSupportActionBar();
        if(actionBar!=null) {
            actionBar.hide();
        }
        handler=new EventHandler();
        button=(Button)findViewById(R.id.setting_exit);
        button.setOnClickListener(handler);
        imageBack=(ImageView)findViewById(R.id.setting_imageback);
    }
    class EventHandler implements View.OnClickListener{

        @Override
        public void onClick(View view) {
            switch(view.getId()){
                case R.id.setting_exit:
                    UserService.removeSession(SettingActivity.this);
                    SettingActivity.this.startActivity(new Intent(SettingActivity.this,MainActivity.class));break;
                case R.id.setting_imageback:
                    SettingActivity.this.startActivity(new Intent(SettingActivity.this,MainActivity.class));
            }
        }
    }
}
